# -*- coding: utf-8 -*-
import sys
from resource_management import *
from resource_management.core.logger import Logger
from resource_management.libraries.functions import default
from resource_management.core.resources.system import Execute
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.script.script import Script
import commands

reload(sys)
sys.setdefaultencoding('utf-8')

config = Script.get_config()

# package download url
kibana_download_url = config['configurations']['ambari-kibana-config']['kibana.package.download.url']

# hdp info
cmd = "/usr/bin/hdp-select versions"
hdp_version = commands.getoutput(cmd)
hdp_base_dir = '/usr/hdp/' + hdp_version

# kibana info
kibana_home = hdp_base_dir + "/kibana"
kibana_log_dir = "/var/log/kibana"
kibana_pid_dir = "/var/run/kibana"
kibana_conf_dir = kibana_home + '/config'
kibana_pid_file = "/var/run/kibana/kibana.pid"
kibana_log_file = "/var/log/kibana/kibana.log"

# kibana-env
kibana_user = config['configurations']['kibana-env']['kibana_user']
kibana_group = config['configurations']['kibana-env']['kibana_group']

# kibana.yml
server_port = config['configurations']['kibana-yml']['server.port']
server_host = config['configurations']['kibana-yml']['server.host']
elasticsearch_url = config['configurations']['kibana-yml']['elasticsearch.url']
kibana_yml = config['configurations']['kibana-yml']['kibana.yml']

